<?php 

require  './configs/config.php';
// require  './models/db.class.php';

// require  './controllers/IndexController.php';
// require  './controllers/UserController.php';
// require  './controllers/GoodsController.php';


// 自动加载类
function __autoload($classname)
{
    if (file_exists("./models/{$classname}.class.php")) {require  "./models/{$classname}.class.php";

    } elseif (file_exists("./controllers/{$classname}.php")) {
            require "./controllers/{$classname}.php";
    } else {
        header("HTTP/1.0 404 Not Found");
        echo  '<h1>404 Not Found  入口文件</h1>';
        exit;
    }
}









// 获取用户传递的参数
// 获取控制器名
$c = (!empty($_GET['c']))?$_GET['c']:'Index';

$a = (!empty($_GET['a']))?$_GET['a']:'index';

// 类名的拼接
$classname = $c.'Controller';

// 实例化
$controller = new $classname();

// 调用方法
$controller->$a();




